﻿
Imports xmlctrl
Imports xhtmlctrl
Imports webctrl

Public Class homepage
    Inherits cacheControlProcessor

    Public Const _pathidentity As String = "/"

    Public Overrides Function pathidentity() As String
        Return _pathidentity
    End Function

    Protected Overrides Function normalRetiredTicks() As Int64
        Return -1 'never retire, until reload
    End Function

    Protected Overloads Overrides Function processImpl(ByVal context As httpContext _
                                                       , ByRef control As xmlcontrol) As Boolean
        Dim page As xhtmlpage = Nothing
        page = New xhtmlpage(context.buff())
        page.title().text = applicationSign() + " - homepage"

        Dim a As a = Nothing
        If config.parameter(configNaming.urlhandlers.name, configNaming.urlhandlers.enableReloader _
                            , configNaming.defaultValue.urlhandlers.enableReloader) Then
            a = New a(context.buff())
            a.href = strmid(reloader._pathidentity, strlen(network.pathSeperator))
            a.text = "reloader"
            page.body().addchild(a)

            page.body().addchild(New br(context.buff()))
        End If

        If config.parameter(configNaming.urlhandlers.name, configNaming.urlhandlers.enableRedirector _
                             , configNaming.defaultValue.urlhandlers.enableRedirector) Then
            a = New a(context.buff())
            a.href = strmid(redirector._pathidentity, strlen(network.pathSeperator))
            a.text = "redirector"
            page.body().addchild(a)

            page.body().addchild(New br(context.buff()))

        End If

        If config.parameter(configNaming.urlhandlers.name, configNaming.urlhandlers.enableSnapshot _
                             , configNaming.defaultValue.urlhandlers.enableSnapshot) Then
            a = New a(context.buff())
            a.href = strmid(snapshot._pathidentity, strlen(network.pathSeperator))
            a.text = "snapshot"
            page.body().addchild(a)

            page.body().addchild(New br(context.buff()))
        End If

        If config.parameter(configNaming.urlhandlers.name, configNaming.urlhandlers.enableCounter _
                             , configNaming.defaultValue.urlhandlers.enableCounter) Then
            a = New a(context.buff())
            a.href = strmid(counter._pathidentity, strlen(network.pathSeperator))
            a.text = "counter"
            page.body().addchild(a)

            page.body().addchild(New br(context.buff()))
        End If

        If config.parameter(configNaming.urlhandlers.name, configNaming.urlhandlers.enableUrlShorten _
                             , configNaming.defaultValue.urlhandlers.enableUrlShorten) Then
            a = New a(context.buff())
            a.href = strmid(urlshorten._pathidentity, strlen(network.pathSeperator))
            a.text = "url shorten"
            page.body().addchild(a)

            page.body().addchild(New br(context.buff()))
        End If

        If config.parameter(configNaming.urlhandlers.name, configNaming.urlhandlers.enableTimenow _
                            , configNaming.defaultValue.urlhandlers.enableTimenow) Then
            a = New a(context.buff())
            a.href = strmid(timenow._pathidentity, strlen(network.pathSeperator))
            a.text = "timenow"
            page.body().addchild(a)

            page.body().addchild(New br(context.buff()))
        End If

        control = page
        Return True
    End Function
End Class
